package com.itheima.task;

import java.lang.reflect.Method;
import java.util.ArrayList;
/*
* 1.ArrayList<Integer> list = new ArrayList<Integer>();
	这个泛型为Integer的ArrayList中存放一个String类型的对象
* */
public class Demo1 {
    public static void main(String[] args) throws Exception {
        ArrayList<Integer> arrayList = new ArrayList<>();
        Class<ArrayList> arrayListClass = ArrayList.class;
        Method add = arrayListClass.getMethod("add", Object.class);
        Object xiaozi = add.invoke(arrayList, "xiaozi");
        System.out.println(xiaozi);
    }
}
